/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2019-12-30
 * Time: 15:33
 */
#ifndef PLANTROBOT_MYTIMEHELPER_H
#define PLANTROBOT_MYTIMEHELPER_H

#include <ctime>

class MyTimeHelper{
private:
    //保存时间
    char my_this_time[25] = {0};
public:
    /**
 * 获取当前时间，在发送信息到服务器中时调用
 * @return
 */
    char *getTimeStr() {
        time_t t = time(NULL);
        strftime(my_this_time, sizeof(my_this_time) - 1, "%Y-%m-%d~%H-%M-%S", localtime(&t));   //年-月-日 时-分-秒
        return my_this_time;
    }
};

#endif //PLANTROBOT_MYTIMEHELPER_H
